import { UseTable } from '@/components';
import InnovationStudioController from '@/services/InnovationStudio/InnovationStudioController';
import React from 'react';

class ApplyConfig extends React.Component {
    constructor(props) {
        super(props);
        let userInfo = JSON.parse(sessionStorage.getItem('userInfo'))
        this.state = { 
            freshen:false,
            userInfo:userInfo,
            query:{}
         };
    }
    getList=(query)=>{
        let {userInfo} = this.state
        query.createdByUserCode= userInfo.userName
       return InnovationStudioController.getList(query)
    }
    handleSearch=(query)=>{
        this.setState({query})
        this.freshen()
    }
    reset=()=>{
        this.setState({query:{}})
        this.freshen()
    }
    freshen=()=>{
        this.setState({freshen:!this.state.freshen})
    }
    render() {
        const {freshen,query} = this.state
        const columns=[
            {title:'工作室编码',dataIndex:'studioCode',align:'center'},
            {title:'工作室名称',dataIndex:'studioName',align:'center'},
            {title:'负责人',dataIndex:'studioLeaderName',align:'center'},
            {title:'创建时间',dataIndex:'createdAt',align:'center'},
            {title:'状态',dataIndex:'studioStatus',align:'center'},            
            {title:'级别',dataIndex:'level',align:'center'},
            {title:'创新办公室审批结果',dataIndex:'officeAgreementResult',align:'center'},
            {title:'创新领导小组审批结果',dataIndex:'groupAgreementResult',align:'center'},
        ]
        return (
            <div>
                <UseTable getData={this.getList} columns={columns} rowKey={'id'} query={query} refresh={freshen} /> 
            </div>
        );
    }
}

export default ApplyConfig;